using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace PuzzleDulex.bamboo
{
    public class Rect
    {
        public int x;
        public int y;
        public int width;
        public int height;

        public Rect(int x, int y, int width, int height)
            : base()
        {
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
        }

        public Rect()
        {
            this.x = this.y = this.width = this.height = 0;
        }

        public bool isPointInRect(int x, int y)
        {

            bool inside = true;

            if (x < this.x || (x > this.x + this.width) || y < this.y
                    || y > (this.y + this.height))
            {
                inside = false;
            }

            return inside;
        }

        public int MidRectX()
        {
            return (this.x + this.width / 2);

        }


        public int MidRectY()
        {
            return (this.y + this.height / 2);
        }

        public int MaxRectX()
        {
            return (this.x + this.width);
        }

        public int MaxRectY()
        {
            return (this.y + this.height);
        }

        public Rectangle ToRectangle()
        {
            return new Rectangle(this.x, this.y, this.width, this.height);

        }

    }
}
